home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / yacc.lang < prev   
Extensible Markup Language  |  2008-09-09  |  5KB  |  173 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: Yevgen Muntyan <muntyan@tamu.edu>
  5.  Copyright (C) 2006-2008 Yevgen Muntyan <muntyan@tamu.edu>
  6.  
  7.  This library is free software; you can redistribute it and/or
  8.  modify it under the terms of the GNU Library General Public
  9.  License as published by the Free Software Foundation; either
  10.  version 2 of the License, or (at your option) any later version.
  11.  
  12.  This library is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  Library General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU Library General Public
  18.  License along with this library; if not, write to the
  19.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  Boston, MA 02111-1307, USA.
  21.  
  22. -->
  23. <language id="yacc" _name="Yacc" _section="Others" version="2.0">
  24.   <metadata>
  25.     <property name="mimetypes">text/x-yacc;text/x-bison</property>
  26.     <property name="globs">*.y;*.yacc</property>
  27.     <property name="line-comment-start">//</property>
  28.     <property name="block-comment-start">/*</property>
  29.     <property name="block-comment-end">*/</property>
  30.   </metadata>
  31.  
  32.   <styles>
  33.     <!--FIXME make it better names, and make them translatable -->
  34.     <style id="keyword" name="keyword" map-to="def:keyword"/>
  35.     <style id="token-type" name="token-type" map-to="def:type"/>
  36.     <style id="rule" name="rule" map-to="def:identifier"/>
  37.   </styles>
  38.  
  39.   <definitions>
  40.     <context id="inline-c">
  41.       <start>^%{</start>
  42.       <end>^%}</end>
  43.       <include>
  44.         <context sub-pattern="0" where="start" style-ref="keyword"/>
  45.         <context sub-pattern="0" where="end" style-ref="keyword"/>
  46.         <context ref="c:c"/>
  47.       </include>
  48.     </context>
  49.  
  50.     <context id="options" style-ref="keyword">
  51.       <prefix>^%</prefix>
  52.       <keyword>debug</keyword>
  53.       <keyword>defines</keyword>
  54.       <keyword>destructor</keyword>
  55.       <keyword>dprec</keyword>
  56.       <keyword>error-verbose</keyword>
  57.       <keyword>expect</keyword>
  58.       <keyword>glr-parser</keyword>
  59.       <keyword>initial-action</keyword>
  60.       <keyword>left</keyword>
  61.       <keyword>lex-param</keyword>
  62.       <keyword>locations</keyword>
  63.       <keyword>merge</keyword>
  64.       <keyword>name-prefix</keyword>
  65.       <keyword>no[_-]lines</keyword>
  66.       <keyword>nonassoc</keyword>
  67.       <keyword>output</keyword>
  68.       <keyword>parse-param</keyword>
  69.       <keyword>prec</keyword>
  70.       <keyword>pure[_-]parser</keyword>
  71.       <keyword>raw</keyword>
  72.       <keyword>require</keyword>
  73.       <keyword>right</keyword>
  74.       <keyword>start</keyword>
  75.       <keyword>token[_-]table</keyword>
  76.       <keyword>union</keyword>
  77.     </context>
  78.  
  79.     <context id="token" end-at-line-end="true">
  80.       <start>^(%(token|type))(<[A-Za-z_][A-Za-z0-9_]*>)?(?![\w_-])</start>
  81.       <include>
  82.         <context sub-pattern="1" where="start" style-ref="keyword"/>
  83.         <context sub-pattern="3" where="start" style-ref="token-type"/>
  84.         <context ref="c:string"/>
  85.         <context ref="c:char"/>
  86.         <context ref="c:float"/>
  87.         <context ref="c:hexadecimal"/>
  88.         <context ref="c:octal"/>
  89.         <context ref="c:decimal"/>
  90.         <context ref="c:comment"/>
  91.         <context ref="c:comment-multiline"/>
  92.       </include>
  93.     </context>
  94.  
  95.     <context id="before-grammar">
  96.       <include>
  97.         <context ref="inline-c"/>
  98.         <context ref="options"/>
  99.         <context ref="token"/>
  100.         <context ref="c:comment"/>
  101.         <context ref="c:comment-multiline"/>
  102.       </include>
  103.     </context>
  104.  
  105.     <context id="after-grammar">
  106.       <start>^%%</start>
  107.       <include>
  108.         <context sub-pattern="0" where="start" style-ref="keyword"/>
  109.         <context ref="c:c"/>
  110.       </include>
  111.     </context>
  112.  
  113.     <context id="c-with-brackets">
  114.       <include>
  115.         <context>
  116.           <start>{</start>
  117.           <end>}</end>
  118.           <include>
  119.             <context ref="c-with-brackets"/>
  120.           </include>
  121.         </context>
  122.         <context style-ref="keyword">
  123.           <match>(\$(<[\w\d_-]*>)?[\$0-9]|[@][$0-9])</match>
  124.         </context>
  125.         <context ref="c:c"/>
  126.       </include>
  127.     </context>
  128.  
  129.     <context id="rule-code">
  130.       <start>{</start>
  131.       <end>}</end>
  132.       <include>
  133.         <context sub-pattern="0" where="start" style-ref="keyword"/>
  134.         <context sub-pattern="0" where="end" style-ref="keyword"/>
  135.         <context ref="c-with-brackets"/>
  136.       </include>
  137.     </context>
  138.  
  139.     <context id="rule">
  140.       <start>[a-zA-Z_.][a-zA-Z0-9_.]*</start>
  141.       <end>;</end>
  142.       <include>
  143.         <context sub-pattern="0" where="start" style-ref="rule"/>
  144.         <context ref="c:comment"/>
  145.         <context ref="c:comment-multiline"/>
  146.         <context ref="c:char"/>
  147.         <context ref="c:string"/>
  148.         <context ref="rule-code"/>
  149.       </include>
  150.     </context>
  151.  
  152.     <context id="grammar">
  153.       <start>^%%</start>
  154.       <include>
  155.         <context sub-pattern="0" where="start" style-ref="keyword"/>
  156.         <context ref="c:comment"/>
  157.         <context ref="c:comment-multiline"/>
  158.         <context ref="c:char"/>
  159.         <context ref="c:string"/>
  160.         <context ref="rule"/>
  161.         <context ref="after-grammar"/>
  162.       </include>
  163.     </context>
  164.  
  165.     <context id="yacc">
  166.       <include>
  167.         <context ref="before-grammar"/>
  168.         <context ref="grammar"/>
  169.       </include>
  170.     </context>
  171.   </definitions>
  172. </language>
  173.